//
//  HXLGuideCollectionViewCell.m
//  On The Load
//
//  Created by 晓琳 on 15/11/12.
//  Copyright © 2015年 @@叶一闽. All rights reserved.
//

#import "HXLGuideCollectionViewCell.h"

@interface HXLGuideCollectionViewCell ()

@property (nonatomic, strong) UIImageView *headImageView;
@property (nonatomic, strong) UIView *bottomView;
@property (nonatomic, strong) NSArray *buttonTitleArray;

@end

@implementation HXLGuideCollectionViewCell

- (instancetype) initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews {
    
    self.buttonTitleArray = @[@"了解当地",@"主要景点",@"签证指南",@"大使馆",@"当地交通",@"实用信息"];
    
    self.headImageView = [[UIImageView  alloc] initWithFrame:CGRectMake(0, 0, 300*SCALEW, 200*SCALEH)];
    [self.contentView addSubview:self.headImageView];
    
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 200*SCALEH, 300*SCALEW, 1)];
    lineView.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:lineView];
    
    self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 201, 300*SCALEW, 400*SCALEH)];
    [self.contentView addSubview:self.bottomView];
    
    [self buttonForBottomView];

    
    
    
}

- (void)buttonForBottomView {
    
    for (int i = 0; i < 6; i++) {
        
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.bottomView addSubview:button];
        button.frame = CGRectMake((i % 2)* 150*SCALEW, (i / 2) * 400/3*SCALEH, 150*SCALEW, 200/3*SCALEH);
        //        button.backgroundColor = [UIColor yellowColor];
        
        [self.bottomView addSubview:button];
        button.tag = 1000 + i;
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [button setTitle:[self.buttonTitleArray objectAtIndex:i] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    
}

- (void) buttonAction:(UIButton *)btn {
    [self.myDelegate pushDetailViewcontroller:btn.tag - 1000];
}


@end
